package com.ruoyi.bom.service.impl;

import com.ruoyi.bom.dto.TwoPeriodCompareDto;
import com.ruoyi.bom.mapper.TqlStapProlossMapper;
import com.ruoyi.bom.service.ITqlProlossService;
import com.ruoyi.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class TqlProlossServiceImpl implements ITqlProlossService {
    @Autowired
    private TqlStapProlossMapper tqlStapProlossMapper;
    @Override
    public List<TwoPeriodCompareDto> twoPeriodCompare(String pandianCode, String lastPandianCode, String flag) {
        return tqlStapProlossMapper.twoPeriodCompare(pandianCode,lastPandianCode,flag);
    }

    @Override
    public List<TwoPeriodCompareDto> twoPeriodCompareDetail(String ids) {
        if(StringUtils.isEmpty(ids))return  null;
        Long[] longArray = Arrays.stream(ids.split(","))
                .map(Long::parseLong)
                .toArray(Long[]::new);
        return tqlStapProlossMapper.twoPeriodCompareDetail(longArray);
    }
}
